package dwdddhhhhh;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.util.HashMap;
import java.util.Iterator;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JDesktopPane;

import HashMap.Data;




public class MapFrame extends JFrame 
{
	public static HashMap<String, Data> map = new HashMap<String, Data>();

	private JPanel contentPane;
	private JMenuBar menuBar;
	private JMenu mnFile;
	private JMenuItem mntmInsert;
	private JMenuItem mntmSelect;
	private JMenuItem mntmUpdatedelete;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) 
	{
		EventQueue.invokeLater(new Runnable() 
		{
			public void run() 
			{
				try 
				{
					MapFrame frame = new MapFrame();
					frame.setVisible(true);
				} catch (Exception e) 
				{
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MapFrame() 
	{
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 500, 400);
		setJMenuBar(getMenuBar_2());
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0,1));
		
		for (int i = 1; i <= 9; i++) 
		{
			map.put("uiux0"+i, new Data("uiux0"+i, "Name0"+i, "1990-04-0"+i, "Seoul No.0"+i));
		}
	}
	private JMenuBar getMenuBar_2() 
	{
		if (menuBar == null) 
		{
			menuBar = new JMenuBar();
			menuBar.add(getMnFile());
		}
		return menuBar;
	}
	private JMenu getMnFile() 
	{
		if (mnFile == null) 
		{
			mnFile = new JMenu("File");
			mnFile.add(getMntmInsert());
			mnFile.add(getMntmSelect());
			mnFile.add(getMntmUpdatedelete());
		}
		return mnFile;
	}
	private JMenuItem getMntmInsert() 
	{
		if (mntmInsert == null) 
		{
			mntmInsert = new JMenuItem("Insert");
			mntmInsert.addActionListener(new ActionListener() 
			{
				public void actionPerformed(ActionEvent arg0) 
				{
					contentPane.removeAll();
					
					contentPane.add(new InsertPanel());
					contentPane.validate();
				}
			});
		}
		return mntmInsert;
	}
	private JMenuItem getMntmSelect() 
	{
		if (mntmSelect == null) 
		{
			mntmSelect = new JMenuItem("Select");
			mntmSelect.addActionListener(new ActionListener() 
			{
				public void actionPerformed(ActionEvent e)
				{
					contentPane.removeAll();
					
					contentPane.add(new SearchPanel());
					contentPane.validate();
				}
			});
		}
		return mntmSelect;
	}
	private JMenuItem getMntmUpdatedelete() 
	{
		if (mntmUpdatedelete == null) 
		{
			mntmUpdatedelete = new JMenuItem("Update&Delete");
			mntmUpdatedelete.addActionListener(new ActionListener() 
			{
				public void actionPerformed(ActionEvent e) 
				{
					contentPane.removeAll();
					
					contentPane.add(new ModifyPanel());
					contentPane.validate();
				}
			});
		}
		return mntmUpdatedelete;
	}
}